// Элемент списка шаблонов
package editor
{
	import Classes.pi_events;
	import Classes.pi_images;
	
	import UIFree.ObjectEvent;
	import UIFree.controls.uif_label;
	import UIFree.uif_component;
	
	import flash.geom.Rectangle;
//	import images.c_mech;

	public class pi_cardPreview extends pi_previewItem {
		private var _userIcon: pi_source;
		public function pi_cardPreview(index: int, parent: uif_component, ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, a_data:*=null, styleClass:String='') {
			super(index, parent, ax, ay, awidth, aheight, a_data, styleClass);
			var inner: Rectangle = getInner();
			if (a_data != null) {
				_prevImage.loadSource(a_data.preview);
				if (a_data.is_new) addChild(new pi_images.c_new());
				if (a_data.price) {
					var priceIcon:* = addChild(new pi_images.c_price());
					priceIcon.y = inner.height - 12;
					app.addEventListener(pi_events.CLEARPRICE, function(e: ObjectEvent): void {
						if ((e.object as Array).indexOf(a_data.id) > -1)
							priceIcon.visible = false;
					});
				}
				if ((a_data.jpg & 0x11) == 0x01) {
					(new uif_label(this, inner.x + inner.width - 18, inner.y + inner.height - 18,
								18, 18, 'desc')).text = 'HI';
				}
			} else {
//				new uif_container(this, c_mech, inner.x, inner.y, inner.width, inner.height);
			}
		}
		
	}
}